// 封装获取频道列表的逻辑
import { useState, useEffect } from'react';
import { getChannelsAPI, } from '@/apis'

function useChannel() {
	const [channelList, setChannelList] = useState([]);
	
	// 获取文章频道数据
	useEffect(() => {
		(async () => {
			const channelsData = await getChannelsAPI().then(res => res.data.channels);
			setChannelList(channelsData)
		})();
	}, [])

	return {
		channelList,
	}
}

export { useChannel }